<template>
  <!-- 个人中心 -->
  <div class="my" v-if="token">
    <!-- 头部背景区域 -->
    <div class="my-top">
      <img src="../assets/image/user/infobg.png" alt="" class="user-img">
    </div>
    <!-- 头像和名字区域 -->
    <div class="user-info">
      <div class="user-head">
        <img src="../assets/image/user/head.jpg" alt="">
      </div>
      <div class="user-naem">
        <h3> m_nl1ax5prx92yl</h3>
      </div>
      <div class="user-vipbg">
        <img src="../assets/image//user/vipbg.png" alt="">
      </div>
    </div>
    <!-- 分类区域 -->
    <div class="user-nav warp">
      <ul>
        <li>
          <img src="../assets/image/user/home.png" alt="">
          <span>主页</span>
        </li>
        <li>
          <img src="../assets/image/user/xiaox.png" alt="">
          <span>消息</span>
        </li>
        <router-link tag="li" to="/collectionList">
          <img src="../assets/image/user/shoc.png" alt="">
          <span>收藏</span>
        </router-link>
        <router-link tag="li" to="/focusOnTheUser">
          <img src="../assets/image/user/guanz.png" alt="">
          <span>关注</span>
        </router-link>
      </ul>
    </div>
    <!-- 购物车区域 -->
    <div class="categories warp">
      <div class="user-left">
        <img src="../assets/image/user/gpuwuche.png" alt="" class="gpuwuche">
        <div class="puwuche-info" @click="$router.push('/shoppingcart')">
          <h3>购物车</h3>
          <p  v-if="cateList.length>0" class="shopnum" ><span >{{cateList.length}}件商品</span><img src="../assets/image/user/jiantou.png" alt="" class="user-jiantou" /></p>
        </div>
      </div>
      <div class="user-right">
        <ul>
          <li>
            <span>卡卷红包</span>
            <p>7张活动卷 <img src="../assets/image/user/jiantou.png" alt="" class="user-jiantou"></p>

          </li>
          <li>
            <span>补贴保障</span>
            <p>退货补运费<img src="../assets/image/user/jiantou.png" alt="" class="user-jiantou"></img></p>
          </li>
          <li>
            <span>我的钱包</span>
            <p>白付美在这<img src="../assets/image/user/jiantou.png" alt="" class="user-jiantou" /></p>
          </li>
        </ul>
      </div>
    </div>
    <!-- 订单区域 -->
    <div class="user-order warp">
      <div class="top">
        <h4>我的订单</h4>
        <p @click="$router.push('/goodsorderlist')">全部<img src="../assets/image/user/jiantou.png" alt="" class="user-jiantou" /></p>
      </div>
      <div class="order-nav">
        <ul>
          <router-link tag="li" :to="{name:'goodsorderlist',query:{active:1}}">
            <img src="../assets/image/user/daifk.png" alt="">
            <p>待付款</p>
          </router-link>
           <router-link tag="li" :to="{name:'goodsorderlist',query:{active:2}}">
            <img src="../assets/image/user/daifh.png" alt="">
            <p>待发货</p>
           </router-link>
          <router-link tag="li" :to="{name:'goodsorderlist',query:{active:3}}">
            <img src="../assets/image/user/daishoh.png" alt="">
            <p>待收货</p>
          </router-link>
          <router-link tag="li" :to="{name:'goodsorderlist',query:{active:4}}">
           <img src="../assets/image/user/pingjia.png" alt="">
            <p>评价</p>
          </router-link>
       
          <router-link tag="li" :to="{name:'goodsorderlist',query:{active:5}}">
            <img src="../assets/image/user/tuiksh.png" alt="">
            <p>退款售后</p>
          </router-link>
        </ul>
      </div>
    </div>
    <!-- 我的设置 -->
    <div class="user-order warp">
      <div class="top">
        <h4>我的设置</h4>
      </div>
      <div class="order-nav">
        <ul>
          <li>
            <img src="../assets/image/user/qiandao.png" alt="">
            <p>签到</p>
          </li>
          <li>
            <img src="../assets/image/user/dayima.png" alt="">
            <p>大姨妈</p>
          </li>
          <li>
            <img src="../assets/image/user/kefu.png" alt="">
            <p>客服</p>
          </li>
          <li>
            <img src="../assets/image/user/darenzx.png" alt="">
            <p>达人中心</p>
          </li>
        </ul>
      </div>
    </div>
    <!-- 退出登录 -->
    <div class="oulogin warp" @click="loginOut">
      <p>退出登录</p>
    </div>
  </div>

</template>

<script>
import { mapMutations, mapState } from "vuex";
export default {
  data() {
    return {};
  },
  computed: {
    ...mapState("m_user", ["token"]),
    ...mapState("m_cart", ["cateList"]),
  },
  methods: {
    ...mapMutations("m_user", ["delToken"]),

    loginOut() {
      this.delToken();
      this.$toast({ message: "已退出", position: "bottom" });
      this.$router.push("/home");
    },
  },
  mounted() {},
};
</script>

<style lang="scss" scoped>
.my {
  height: 100vh;
  // width: 100%;
  padding-bottom: 80px;
  background-color: #f6f6f6;
}
.warp {
  margin: 0 10px;
}
.my-top {
  .user-img {
    width: 100%;
  }
}
.user-info {
  position: absolute;
  top: 50px;
  left: 10px;
  right: 10px;
  height: 130px;
  border-radius: 6px;
  background-color: #fff;
  .user-head {
    width: 60px;
    height: 60px;
    border: 2px solid #fff;
    border-radius: 50%;
    overflow: hidden;
    position: absolute;
    top: -50%;
    left: 50%;
    transform: translate(-50%, 50%);
    img {
      width: 100%;
    }
  }
  .user-naem {
    padding-top: 40px;
    text-align: center;
    h3 {
    }
  }
  .user-vipbg {
    width: 100%;
    height: 55px;
    img {
      width: 100%;
      height: 100%;
      margin-top: 10px;
      object-fit: cover;
    }
  }
}
.user-nav {
  height: 70px;
  margin-top: 73px;
  background-color: #fff;
  border-radius: 6px;
  ul {
    display: flex;
    height: 100%;
    align-items: center;
    li {
      width: 20%;

      display: flex;
      flex-direction: column;
      align-items: center;
      font-size: 12px;
      color: #5e5e5e;
      text-align: center;

      box-sizing: border-box;
      img {
        width: 25px;
        height: 25px;
      }
      span {
        padding: 5px 0;
      }
    }
  }
}
.categories {
  display: flex;
  margin-top: 10px;
  p {
    font-size: 12px;
    color: #999999;
    display: flex;
    align-items: center;
  }

  .user-jiantou {
    width: 8px;
    height: 10px;
    object-fit: cover;
  }
  div {
    width: 50%;
    background-color: #fff;
    border-radius: 6px;
  }
  .user-left {
    margin-right: 10px;
    position: relative;
    .gpuwuche {
      width: 100%;
    }
    .puwuche-info {
      position: absolute;
      top: 10px;
      left: 10px;
      .shopnum {
        margin-top: 5px;
        img {
          margin-left: 2px;
        }
      }
    }
  }
  .user-right {
    ul {
      li {
        height: 40px;
        line-height: 40px;
        display: flex;
        align-items: center;
        justify-content: space-between;
        margin: 0 12px;
        span {
          font-size: 14px;
        }
      }
    }
  }
}
.user-order {
  margin-top: 10px;
  .top {
    background-color: #fff;
    height: 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 10px;
    border-bottom: 1px solid #efefef;
    h4 {
    }
    p {
      font-size: 12px;
      color: #999999;
      display: flex;
      align-items: center;
      img {
        width: 10px;
        height: 10px;
        object-fit: cover;
      }
    }
  }
  .order-nav {
    height: 70px;
    background-color: #fff;
    ul {
      display: flex;
      height: 100%;
      align-items: center;
      text-align: center;
      li {
        width: 20%;
        img {
          width: 25px;
          height: 25px;
        }
        p {
          font-size: 12px;
          color: #666666;
        }
      }
    }
  }
}
.oulogin {
  height: 40px;
  background-color: #ff5777;
  margin-top: 10px;
  border-radius: 6px;
  color: #fff;
  text-align: center;
  line-height: 40px;
  font-size: 14px;
}
</style>